package org.meteorshower.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseObj<T> {
    private String code;
    private String message;
    private T data;

    public static <T> ResponseObj<T> ok(T data) {
        return new ResponseObj<>("200", "success", data);
    }

    public static <T> ResponseObj<T> ok() {
        return new ResponseObj<>("200", "success", null);
    }

    public static <T> ResponseObj<T> fail(String code, String message) {
        return new ResponseObj<>(code, message, null);
    }

}
